package com.ct.utils.exception;


import com.ct.utils.result.IResultCode;
import com.ct.utils.result.ResultEnum;

/**
 * 自定义API异常
 * Created by zfjk on 2020/2/27.
 */
public class ApiException extends RuntimeException {
    private final Integer code;

    private final String name;
    private final String msg;


    public ApiException(String name, String msg){
        super(msg);
        this.name = name;
        this.msg = msg;
        this.code = ResultEnum.SERVER_ERROR.getCode();
    }

    public ApiException(IResultCode iResultCode) {
        super(iResultCode.getMsg());
        this.code = iResultCode.getCode();
        this.name = iResultCode.getCodeDesc();
        this.msg = iResultCode.getMsg();
    }

    public Integer getCode() {
        return code;
    }
    public String  getName() {
        return name;
    }

    public String getMsg() {
        return msg;
    }


}
